#include "stdafx.h"
#include "DrawObjHelper.h"

#include "GlobalData.h"

namespace DrawObjHelper
{
    ExportXSkinLib HFONT   GetFont(LONG lFontSize, BOOL bBold, BOOL bItalic, BOOL bUnderline, BOOL bStrikeOut, LPCTSTR szFontName)
    {
        HFONT hFont = NULL;
        INVOKE_GLOBALDATA_METHOD_R(hFont,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetFont,
            lFontSize, bBold, bItalic, bUnderline, bStrikeOut, szFontName);
        return hFont;
    }

    ExportXSkinLib HFONT GetDefaultFont()
    {
        HFONT hFont = NULL;
        INVOKE_GLOBALDATA_METHOD_R(hFont,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetDefaultFont);
        return hFont;
    }

    ExportXSkinLib HCURSOR GetCursor(LPCTSTR szCursor)
    {
        HCURSOR hCursor = NULL;
        INVOKE_GLOBALDATA_METHOD_R(hCursor,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetCursor,
            szCursor);
        return hCursor;
    }

    ExportXSkinLib HCURSOR GetCursor(LPCTSTR szCursor, HMODULE hResModule)
    {
        HCURSOR hCursor = NULL;
        INVOKE_GLOBALDATA_METHOD_R(hCursor,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetCursor,
            szCursor, hResModule);
        return hCursor;
    }

    ExportXSkinLib HCURSOR GetDefaultCursor()
    {
        HCURSOR hCursor = NULL;
        INVOKE_GLOBALDATA_METHOD_R(hCursor,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetDefaultCursor);
        return hCursor;
    }

    ExportXSkinLib void    ReleaseCursor(HCURSOR hCursor)
    {
        INVOKE_GLOBALDATA_METHOD(
            GetSkinObjMgr,
            XSkinObjMgr,
            ReleaseCursor,
            hCursor);
    }

    ExportXSkinLib XCANVAS CreateCanvas(XIMAGE xImage)
    {
        XCANVAS canvas = NULL;
        INVOKE_GLOBALDATA_METHOD_R(canvas,
            GetSkinObjMgr,
            XSkinObjMgr,
            CreateCanvas,
            xImage);
        return canvas;
    }

    ExportXSkinLib XCANVAS CreateCanvas(int nBitsPerPixel)
    {
        XCANVAS canvas = NULL;
        INVOKE_GLOBALDATA_METHOD_R(canvas,
            GetSkinObjMgr,
            XSkinObjMgr,
            CreateCanvas,
            nBitsPerPixel);
        return canvas;
    }

    ExportXSkinLib void    DeleteCanvas(XCANVAS xCanvas)
    {
        INVOKE_GLOBALDATA_METHOD(
            GetSkinObjMgr,
            XSkinObjMgr,
            DeleteCanvas,
            xCanvas);
    }

    // Can't be deleted!
    ExportXSkinLib XCANVAS GetCanvas(XIMAGE xImage)
    {
        XCANVAS canvas = NULL;
        INVOKE_GLOBALDATA_METHOD_R(canvas,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetTempCanvas,
            xImage);
        return canvas;
    }

    ExportXSkinLib XCANVAS GetCanvas(int nBitsPerPixel)
    {
        XCANVAS canvas = NULL;
        INVOKE_GLOBALDATA_METHOD_R(canvas,
            GetSkinObjMgr,
            XSkinObjMgr,
            GetTempCanvas,
            nBitsPerPixel);
        return canvas;
    }
}